// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  // 应用配置
  app: {
    head: {
      title: 'Front_Yue_Chat',
      htmlAttrs: {
        lang: 'zh-CN'
      },
      meta: [
        { charset: 'utf-8' },
        { name: 'viewport', content: 'width=device-width, initial-scale=1' },
        { name: 'description', content: 'Front_Yue - 前端技术集成平台，提供技术文章、AI智能问答、云存储、图片管理、开发工具等多元化服务' },
        { name: 'format-detection', content: 'telephone=no' },
        { name: 'keywords', content: '前端技术,AI助手,云存储,智云问答,技术文章,开发工具,Front_Yue' },
        { name: 'author', content: 'Front_Yue Team' },
        { name: 'robots', content: 'index, follow' },
        { property: 'og:title', content: 'Front_Yue' },
        { property: 'og:description', content: '前端技术集成平台，提供技术文章、AI智能问答、云存储、图片管理、开发工具等多元化服务' },
        { property: 'og:type', content: 'website' },
        { name: 'theme-color', content: '#6366f1' }
      ],
      link: [
        { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
      ]
    }
  },

  // CSS
  css: [
    '~/assets/css/global.css'
  ],
  
  // 是否启用SSR
  ssr: true,

  // 组件自动导入
  components: true,

  // 模块
  modules: [
    '@element-plus/nuxt'
    // 需要安装兼容Nuxt 3的axios模块
  ],
  
  // 运行时配置
  runtimeConfig: {
    // 服务端私有配置
    private: {
      apiBase: 'http://localhost:8010'
    },
    // 客户端和服务端都可访问的配置
    public: {
      apiBase: '/api'
    },
    app: {
      buildId: new Date().getTime().toString(),
      baseURL: '/',
      buildAssetsDir: '/_nuxt/',
      cdnURL: ''
    }
  },

  // Nitro配置
  nitro: {
    // 开发环境API代理
    devProxy: {
      '/api': {
        target: 'http://127.0.0.1:8010',
        changeOrigin: true,
        prependPath: true,
      }
    }
  },

  // 开发服务器配置
  devServer: {
    host: '0.0.0.0',
    port: 3000
  }
})
